#pragma once

//#include <Windows.h>
#include "Bot.h"
#include "Entity.h"
#include <math.h>

class Bot;

class State
{
protected:
	Bot* Parent;	
	Entity* Target;

public:
	State();
	State(Bot *nParent,  Entity *nTarget);
	~State();

	virtual void SetParent( Bot *nParent);
	virtual void SetTarget( Entity *nTarget);

	virtual void Enter( void ) = 0;
	virtual void Execute( float dt ) = 0;
	virtual void Exit( void ) = 0;
};

class Seek : public State
{
private:

public:
	Seek();
	Seek(Bot *nParent,  Entity *nTarget);
	~Seek();

	void SetTarget( Entity *nTarget);
	virtual void Enter( void );
	virtual void Execute( float dt );
	virtual void Exit ( void );
};

class LeadSeek : public State
{
private:

public:
	LeadSeek();
	LeadSeek(Bot *nParent,  Entity *nTarget);
	~LeadSeek();

	void SetTarget( Entity *nTarget);
	virtual void Enter( void );
	virtual void Execute( float dt );
	virtual void Exit ( void );
};

class Flee : public State
{
private:

public:
	Flee();
	Flee(Bot *nParent,  Entity *nTarget);
	~Flee();

	void SetTarget( Entity *nTarget);
	virtual void Enter( void );
	virtual void Execute( float dt );
	virtual void Exit ( void );
};

#define UPPERTIMELIM 10.f

class Wander : public State
{
private:
	D3DXVECTOR3 Direction;
	float Time;
	float NextDirectionChange;
	D3DXVECTOR3 GenerateNewDirection( void );
	float GenerateNewTime(float upperLimit);

public:
	Wander();
	Wander(Bot *nParent,  Entity *nTarget);
	~Wander();

	void SetTarget( Entity *nTarget);
	virtual void Enter( void );
	virtual void Execute( float dt );
	virtual void Exit ( void );

};